package com.st.controller;

import com.st.entity.*;
import com.st.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService iUserService;
    //查询所有用户
    @RequestMapping("/search")
    public PageResult<User> search(@RequestBody PageDTO<User> pageDTO){
        return iUserService.findAll(pageDTO);
    }
    //删除用户
    @RequestMapping("/delUser")
    public Result delUser(String uid){
        return iUserService.delUser(uid);
    }
    //设置用户类型，是否启用
    @RequestMapping("/updateUser")
    public Result updateUser(@RequestBody User user){
        return iUserService.updateUser(user);
    }

    @RequestMapping("/searchUserInfo")
    public Result searchUserInfo(@RequestBody UserInfo userInfo){
        return iUserService.searchUserInfo(userInfo);
    }
}
